﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Forms;
using System.Drawing;

namespace Lottery.Control {
    public class ComboEdit : ComboBox {
        /// <summary>
        /// 按回车键的时候，焦点跳转到的控件
        /// </summary>
        public System.Windows.Forms.Control JumpToNext { get; set; }

        protected override void OnKeyDown(KeyEventArgs e) {
            if (e.KeyCode == Keys.Return && JumpToNext != null) {
                e.Handled = true;
                JumpToNext.Focus();
            }

            base.OnKeyDown(e);
        }

        private Color oldBackColor;

        protected override void OnEnter(EventArgs e) {
            base.OnEnter(e);

            oldBackColor = BackColor;
            BackColor = Color.Aqua;
        }

        protected override void OnLeave(EventArgs e) {
            BackColor = oldBackColor;

            base.OnLeave(e);
        }

    }
}
